## CFP
Since the dawn of Forums, CodeProject and Stack Overflow - and more recently with Our Umbraco, Github, Discord, Youtube and blog posts - we've been building applications with strangers on the internet, copying and pasting other developers' code. And now with the advent of ChatGPT, GitHub CoPilot and other AI solutions, it's easier than ever to use code somebody (or something) else wrote... without necessarily understanding the code completely. We all copy and paste code, but a senior developer will often approach the task in different way to someone more junior. We'll look at how to level-up our Ctrl+V game through understanding the problem, assessing suitability and adapting code samples to meet our needs. Together, we can build something better and quicker... so long as we know what we're building.
![bg left:40%](images/surfing-the-web.png)
We've all heard that software developers are just "professional Googlers" - the more senior you are is mostly a product of how good you are at Googling.
It's a great joke... but have you tried being a developer _without_ internet access? It doesn't feel like much of a joke then, does it?
But I don't see this as a negative. When we're isolated we might feel weak and hopeless but as a team - a community - we're quick and efficient problem solvers. And that's where the idea for this talk came from: how can we work together more effectively as a worldwide developer community without getting stung along the way?
This photo is from after a Umbraco festival in the UK, when me and Paul (from Codeshare, creater of the Clean Starter Kit) went back to our hotel.
The aim was to grab a snack and get some sleep, but we accidentally ended up fixing some bugs in the Clean Starter Kit together!
In an open source world, we're much stronger together.
So we shouldn't be afraid to ask for help, and to offer our expertise to others.
Before we start with how and what to copy and paste, let's first start with some places we might find answers -
StackOverflow - good for more generic development questions
Github? - some repositories have discussions or issues may be appropriate
Umbraco Forum - specific to Umbraco
Discord - specific to Umbraco
Mastodon/X/Facebook
Shameless Mastodon Plug
There's a strong contingent of the Umbraco Community now using **Mastodon** in place of Twitter/X.
94 active users as of yesterday
+ users on other servers
Already on masto? Directory
Want to join the community masto? Link
How can we ask for help in a way that's most likely to get the best possible answer?
Although the community is very helpful, it't to our own benefit to ask the right questions in the right places.
Do your research *first*
Although you've already searched for an answer to your question, it's also important we do some background research so we can explain ourselves correctly and be very specific about our problem.
Comprehend the problem
There's very little point in asking a question if we don't know what we're asking. If we don't understand what we're asking we need to ask a different question
Comprehend here basically means "understand", but I feel it emphasises we don't need to *understand* everything, just *comprehend* what we *wan't* to understand.
Be polite and patient - nobody _has_ to help you
On-topic and suitable (including tags, categories, etc)
Summarize your problem
Include a reproducible example
---
We know this is good advice, because it inspired by StackOverflow. And if anybody is fussy about how you ask a question, it's them!
As a junior fresh-out-of-his-apprenticeship developer, I had a boss called Mr Savage.
We'd often call him over to ask him questions, only to have the answer immediately present itself without him saying a word.
We called this "Savaging from behind" - all he had to do was stand behind us and the problem was solved.
Other developers have discovered this solution, but not all of them had a Mr Savage!
They had to settle for a rubber duck on their desk (or anything with a face, really)
The idea:
forming your questions into actual verbalised queries
providing context
out loud
can help yourself to better understand a problem
come up with a solution
This can really help with the "comprehend the problem" step
### **<i class="fad fa-duck"></i>**
Discord - one person can ask questions to help work out what you need
Social media - lots of people can chime in with their opinions and experiences
Forum - tend to be longer questions with longer answers
Do your research: Read my blog post
Understand the problem: detailed, said what he's tried
Be polite: Flattery will get you everywhere! Friendly, sociable, "TIA"
On topic & suitable: Umbraco Discord, help-with-umbraco channel, hoping for a quick, short reply (it actually helped us chat it over and try things out without me needing to replicate)
Summarize your problem: Pictures! "I would like to..."
Reproducible example: Provided Umbraco version, media picker version, exact setup - I could do this!
We've been talking a lot about community and collaboration - so why am I brining up artificial intelligence? Is it because I want this talk to sound topical and modern? Well... yes. But only in part!
AI has been scouring the internet looking at _our_ programs and _our_ code samples. As I see it, AI is a tool built by the community. And it takes a lot of the same skills to effectively use AI generated code as it does to pick the right Stack Overflow answer.
Let's see how Scott Hanselman uses AI to rubber duck
[Play video]
You know what AI is also good at? Generating pictures of rubber ducks in an office setting...
You know what AI is also good at? Generating pictures of rubber ducks in an office setting...
You know what AI is also good at? Generating pictures of rubber ducks in an office setting...
...or rubber ducks using humans as rubber ducks
Makes things up: AI will rarely tell you that you can't do something. It will generally make up ways you can... even if those ways are not possible and use API methods that simply don't exist.
So, you've asked a question and got an answer.
Example: searching for a way to add asterisk to fields without extra markup
Come across this stack overflow answer
Uses background image on the input to draw an image of an asterisk.
If we didn't know better (or think it through) this is a valid solution to the question
Look at the question
they're asking a different question!
They're saying the *more correct* solution doesn't work for them.
May sound like a contrived answer to question
It's real
I answered it
That's my answer!
Kept getting upvotes for it.
I know there's no way that was the correct answer for anyone else.
They've been Googling like we said and come across my *marked as solution* answer!
Added a comment to highlight better solutions
Then edited the answer to highlight the better solution
Then made that warning big and bold
Then finally gave in and deleted my answer!
It was the right answer for this person, but others were mistaking it for their correct answer **SO OFTEN**
So here's Joe's guide to comprehending and assessing suitability.
- Answer Q?
- Does the answer make sense as a response to my question?
- Could've misread/misunderstood
- Is my question the same one as being answered?
- If reading someone elses question
- Line by line
- If it's a code solution, what does each line do?
- We don't need to understand every intricacy of the code,
but we should have an ***idea*** line-by-line what it's doing
- Match description
- Does a written description match up with what the code does?
- If not - bad smell!
- Feel right
- How's the gut feel?
- What existing knowledge can we apply?
- Increase confidence
- What else could we ask or look up to reassure us?
Applied to my last
- Answer Q? - No, answering a different one
- Line by line - adding an image
- Match description - yes
- Feel right - NO! Background knowledge - There's no semantics here, background images not readable by a screen reader
- Increase confidence - no need, we've already failed! Could look up semantics of required fields
Let's look at another example...
Does it answer my question?
Read Q and A
Line by line, what is this doing?
- takes a hex string value
- splits out R/G/B values
- converts them from hex to int
- calculates a "luminance"
- checks for luminance value (128 = 256/2)
Does the code match the description?
The code seems to match up with the description
Does that _feel_ right?
- things I don't fully understand
- generally somewhat like I was expecting
- I didn't know the hex conversion function existed, but it seems right
How can we increase our confidence in this answer?
Most useful info: I now know I want to calculate the luminance.
So now I can go away and validate the luminance formula (which it got right!) and we're away!
I can also check luminance is